<?php

//require_once ("C_krn_exception.php");
//*require_once ("C_krn_tools.php");
require_once ("C_krn_session.php");


class c_HTML_web {
	
	/* Evitamos el clonaje del objeto. Patrón Singleton */
	private function __clone() {
	}
	private function __wakeup() {
	}
	private function getHTML_SMS() {
		global $IDIOMA, $language;
		
		$r = '';
		
		$r = $r . '<div id="fadeCapa" name="fadeCapa" class="" ></div>' . "\n";
		
		$r = $r . '<div class="info message" style="top: -100px;" name="info-sms" id="info-sms" VISIBLE="NO" >' . "\n";
		$r = $r . '		 <h3 name="info-sms-head" id="info-sms-head">MENSAJE INFO!</h3>' . "\n";
		$r = $r . '		 <p  name="info-sms-body" id="info-sms-body">This is just an info notification message.</p>' . "\n";
		$r = $r . '		 <a href="#" class="trigger info-trigger" name="info_trigger" id="info_trigger" >Cerrar</a>' . "\n";
		$r = $r . '</div>' . "\n";
		
		$r = $r . '<div class="error message" style="top: -100px;" name="error-sms" id="error-sms"  VISIBLE="NO" >' . "\n";
		$r = $r . '		 <h3 name="error-sms-head" id="error-sms-head">MENSAJE ERROR</h3>' . "\n";
		$r = $r . '		 <p  name="error-sms-body" id="error-sms-body">This is just an error notification message.</p>' . "\n";
		$r = $r . '		 <a href="#" class="trigger error-trigger" name="error_trigger" id="error_trigger" >Cerrar</a>' . "\n";
		$r = $r . '</div>' . "\n";
		
		$r = $r . '<div class="warning message" style="top: -100px;" name="warning-sms" id="warning-sms"  VISIBLE="NO" >' . "\n";
		$r = $r . '		 <h3 name="warning-sms-head" id="warning-sms-head">MENSAJE WARNING!</h3>' . "\n";
		$r = $r . '		 <p  name="warning-sms-body" id="warning-sms-body">This is just a warning notification message.</p>' . "\n";
		$r = $r . '		 <a href="#" class="trigger warning-trigger" name="warning_trigger" id="warning_trigger" >Cerrar</a>' . "\n";
		$r = $r . '</div>' . "\n";
		
		$r = $r . '<div class="success message" style="top: -100px;" name="success-sms" id="success-sms"  VISIBLE="NO" >' . "\n";
		$r = $r . '		 <h3 name="success-sms-head" id="success-sms-head">MENSAJE Ok!</h3>' . "\n";
		$r = $r . '		 <p  name="success-sms-body" id="success-sms-body">This is just a success notification message.</p>' . "\n";
		$r = $r . '		 <a href="#" class="trigger success-trigger" name="success_trigger" id="success_trigger" >Cerrar</a>' . "\n";
		$r = $r . '</div>' . "\n";
		
		$r = $r . '<br />' . "\n";
		
		return $r;
	}
	public function getHTML_web($FORM_OPERATION) {
		global $cAUDIT;
		global $cUTIL;
		global $BD;
		global $IDIOMA, $language;

		$cAUDIT->AddAudit ( AUDIT_EXTEND, __DIR__, __FILE__, __LINE__, __CLASS__, __METHOD__, __FUNCTION__, $language [$IDIOMA] [35] . $FORM_OPERATION );
		
		// Case que nos discrimina las posibles opciones
		
		$r = '';
		
		switch ($FORM_OPERATION) {
/*		
			case "GESTION_USUARIOS" :
				$r = '';
				
				$r = $r . $this->getHTML_SMS ();
				
				$r = $r . '<div id="toolbar" class="ui-widget-header ui-corner-all">' . "\n";
				$r = $r . '  <button id="USER_NEW">Crear usuario</button>' . "\n";
				$r = $r . '  <button id="USER_DROP">Borrar usuario</button>' . "\n";
				$r = $r . '  <button id="USER_REFRESH">Refrescar</button>' . "\n";
				$r = $r . '  <button id="USER_LOCK">Unlock</button>' . "\n";
				$r = $r . '</div>' . "\n";
				
				// Estos dos componentes se rellenan desde una llamada jquery
				// Tabla que contiene el grid de jqgrid
				$r = $r . '  <table id="JQGRID_LIST"  name="JQGRID_LIST" FORM_OPERATION="GET_GRID_USERS" CONNECT_MODE="' . $cUTIL->getDEVICE_TYPE () . '"><tr><td></td></tr></table>' . "\n";
				// Paginador del jqgrid
				$r = $r . '  <div   id="JQGRID_PAGER" name="JQGRID_PAGER"></div>' . "\n";
				
				break;
			
			case "INDEX_FORM_NEW_USER" :
				
				$r = '';
				
				$r = $r . $this->getHTML_SMS ();
				
				$r = $r . '<div id="div_web" name="div_web" >' . "\n";
				$r = $r . ' <span >' . "\n";
				
				if ($FORM_OPERATION == "INDEX_FORM_NEW_USER")
					$r = $r . '  <h1>' . $language [$IDIOMA] [85] . '</h1>' . "\n";
				else
					$r = $r . '  <h1>' . $language [$IDIOMA] [90] . '</h1>' . "\n";
				
				$r = $r . '  <form name="' . $FORM_OPERATION . '_form" id="' . $FORM_OPERATION . '_form" FORM_OPERATION="AJAX_JQUERY_USER" CONNECT_MODE="' . $cUTIL->getDEVICE_TYPE () . '" method="POST" action="" accept-charset="UTF-8">' . "\n";
				$r = $r . '		<table cellpadding="0" cellspacing="0" border="0">' . "\n";
				$r = $r . '			<tr>' . "\n";
				$r = $r . '				<td>Email:</td>' . "\n";
				$r = $r . '				<td><input type="text" name="' . $FORM_OPERATION . '_email" id="' . $FORM_OPERATION . '_email" /></td>' . "\n";
				$r = $r . '				<td><img name="' . $FORM_OPERATION . '_email_check" id="' . $FORM_OPERATION . '_email_check" src="images/cross.png" /></td>' . "\n";
				$r = $r . '				<td><img name="' . $FORM_OPERATION . '_email_find" id="' . $FORM_OPERATION . '_email_find" src="" /></td>' . "\n";
				$r = $r . '			</tr>' . "\n";
				$r = $r . '			<tr>' . "\n";
				$r = $r . '				<td>Password:</td>' . "\n";
				$r = $r . '				<td><input type="password" name="' . $FORM_OPERATION . '_password" id="' . $FORM_OPERATION . '_password" /></td>' . "\n";
				$r = $r . '				<td><img name="' . $FORM_OPERATION . '_password_check" id="' . $FORM_OPERATION . '_password_check" src="images/cross.png" /></td>' . "\n";
				$r = $r . '			</tr>' . "\n";
				
				if ($FORM_OPERATION == "INDEX_FORM_NEW_USER") {
					$r = $r . '			<tr>' . "\n";
					$r = $r . '				<td colspan="2" align="right" >' . "\n";
					$r = $r . '				 <div name="' . $FORM_OPERATION . '_progressbar" id="' . $FORM_OPERATION . '_progressbar"  ></div>' . "\n";
					$r = $r . '				</td>' . "\n";
					$r = $r . '			</tr>' . "\n";
				}
				
				$r = $r . '			<tr>' . "\n";
				$r = $r . '				<td colspan="2" align="right" >' . "\n";
				$r = $r . '				 <img class="centro" name="' . $FORM_OPERATION . '_timer" id="' . $FORM_OPERATION . '_timer" />' . "\n";
				$r = $r . '				 <button id="' . $FORM_OPERATION . '_ok"     name="' . $FORM_OPERATION . '_ok">Acceder</button>' . "\n";
				$r = $r . '				</td>' . "\n";
				$r = $r . '			</tr>' . "\n";
				$r = $r . '			<tr>' . "\n";
				$r = $r . '				<td align="right" ></td><td align="left">' . "\n";
				$r = $r . '				 <span>' . $language [$IDIOMA] [84] . '</span>' . "\n";
				$r = $r . '				</td>' . "\n";
				$r = $r . '			</tr>' . "\n";
				$r = $r . '		</table>' . "\n";
				$r = $r . '	 </form>' . "\n";
				$r = $r . '</div>' . "\n";
				
				break;
			
			/*
			 * case "INDEX_FORM_NEW_USER": $r = ''; $r = $r . $this->getHTML_SMS(); $r = $r . '<div id="div_web" name="div_web" >'."\n"; $r = $r . ' <span >'."\n"; $r = $r . ' <h1>'.$language[$IDIOMA][85].'</h1>'."\n"; $r = $r . ' <form name="'.$FORM_OPERATION.'_form_new_user" id="'.$FORM_OPERATION.'_form_new_user" FORM_OPERATION="AJAX_JQUERY_NEW_USER" CONNECT_MODE="'.$cUTIL->getDEVICE_TYPE().'" method="POST" action="" accept-charset="UTF-8">'."\n"; $r = $r . '		<table cellpadding="0" cellspacing="0" border="0">'."\n"; $r = $r . '			<tr>'."\n"; $r = $r . '				<td>Email:</td>'."\n"; $r = $r . '				<td><input type="text" name="'.$FORM_OPERATION.'_email_new_user" id="'.$FORM_OPERATION.'_email_new_user" /></td>'."\n"; $r = $r . '				<td><img name="'.$FORM_OPERATION.'_email_check_new_user" id="'.$FORM_OPERATION.'_email_check_new_user" src="images/cross.png" /></td>'."\n"; $r = $r . '				<td><img name="'.$FORM_OPERATION.'_email_find_new_user" id="'.$FORM_OPERATION.'_email_find_new_user" src="" /></td>'."\n"; $r = $r . '			</tr>'."\n"; $r = $r . '			<tr>'."\n"; $r = $r . '				<td>Password:</td>'."\n"; $r = $r . '				<td><input type="password" name="'.$FORM_OPERATION.'_password_new_user" id="'.$FORM_OPERATION.'_password_new_user" /></td>'."\n"; $r = $r . '				<td><img name="'.$FORM_OPERATION.'_password_check_new_user" id="'.$FORM_OPERATION.'_password_check_new_user" src="images/cross.png" /></td>'."\n"; $r = $r . '			</tr>'."\n"; $r = $r . '			<tr>'."\n"; $r = $r . '				<td colspan="2" align="right" >'."\n"; $r = $r . '				 <div name="'.$FORM_OPERATION.'_progressbar" id="'.$FORM_OPERATION.'_progressbar" ></div>'."\n"; $r = $r . '				</td>'."\n"; $r = $r . '			</tr>'."\n"; $r = $r . '			<tr>'."\n"; $r = $r . '				<td colspan="2" align="right" >'."\n"; $r = $r . '				 <img class="centro" name="'.$FORM_OPERATION.'_timer_new_user" id="'.$FORM_OPERATION.'_timer_new_user" />'."\n"; $r = $r . '				 <button id="'.$FORM_OPERATION.'_ok_new_user" name="'.$FORM_OPERATION.'_ok_new_user">Acceder</button>'."\n"; $r = $r . '				</td>'."\n"; $r = $r . '			</tr>'."\n"; $r = $r . '			<tr>'."\n"; $r = $r . '				<td align="right" ></td><td align="left">'."\n"; $r = $r . '				 <span>'.$language[$IDIOMA][84].'</span>'."\n"; $r = $r . '				</td>'."\n"; $r = $r . '			</tr>'."\n"; $r = $r . '		</table>'."\n"; $r = $r . '	 </form>'."\n"; $r = $r . '</div>'."\n"; break;
			 */
			
			case "INDEX" :
				//			case "INDEX_FORM_LOGOUT" :
				
				$r = '';
				$r = $r . $this->getHTML_SMS ();
				$r = $r . '   <div id="div_web" name="div_web" class="centro" >' . "\n";
				$r = $r . '   <br />' . "\n";
        $r = $r . '   <h1>' . $language [$IDIOMA] [7] . '</h1>' . "\n";
				$r = $r . '   <img alt="' . $language [$IDIOMA] [26] . '" style="border-width:0" width="20%" src="images/logo.png" />' . "\n";
        $r = $r . '   <p><a class="btn btn-large btn-success" href="#">' . $language [$IDIOMA] [42] . '</a></p>' . "\n";
				$r = $r . '   </div>' . "\n";
				break;
			
			case "INDEX_FORM_ABOUT" :
				
				$r = '';
				$r = $r . $this->getHTML_SMS ();
				$r = $r . '<div id="div_web" name="div_web" class="centro" >' . "\n";
				$r = $r . ' <br />' . "\n";
				$r = $r . ' <span >' . "\n";
				$r = $r . '  <h1>' . $language [$IDIOMA] [26] . ' v' . VERSION_HIGH . '.' . VERSION_LOW . '.' . VERSION_COMPILATION . '</h1>' . "\n";
				$r = $r . '  <br />' . "\n";
				$r = $r . '  <p>' . $language [$IDIOMA] [66] . '</p>' . "\n";
				$r = $r . '  <br />' . "\n";
				$r = $r . '  <p>Email de <a href="email:' . EMAIL_ADMIN . '">contacto<a/>.</p>' . "\n";
				$r = $r . '  <br /><a rel="license" href="' . $language [$IDIOMA] [27] . '"><img alt="' . $language [$IDIOMA] [76] . '" style="border-width:0" src="images/licencia.png" /></a>' . '</a>';
				$r = $r . ' </span>' . "\n";
				$r = $r . '</div>' . "\n";
				break;
			
			case "INDEX_FORM_ADMIN" :
			  $r = '';
				$r = $r . $this->getHTML_SMS ();
				$r = $r . '<br />';
			  $r = $r . '<br />';
			  
			  // Creamos las pestañas y las tablas
			  $r_pestanas = '';
			  $r_pestanas = $BD->CrearPestanas ();
			  
			  $r = $r . $r_pestanas;

        
			break;
/*		
			case "SHOPPING_LIST" :
				
				$r = '';
				$r = $r . $this->getHTML_SMS ();
				$r = $r . '<div id="tabs">' . "\n";
				$r = $r . '  <ul>' . "\n";
				$r = $r . '    <li><a href="#tabs-1">' . $language [$IDIOMA] [101] . '</a></li>' . "\n";
				$r = $r . '    <li><a href="#tabs-2">' . $language [$IDIOMA] [102] . '</a></li>' . "\n";
				$r = $r . '    <li><a href="#tabs-3">Aenean lacinia</a></li>' . "\n";
				$r = $r . '  </ul>' . "\n";
				$r = $r . '  <div id="tabs-1">' . "\n";
				$r = $r . '    <p>Proin elit arcu, rin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>' . "\n";
				$r = $r . '  </div>' . "\n";
				$r = $r . '  <div id="tabs-2">' . "\n";
				$r = $r . '    <h2>Content heading 2</h2>' . "\n";
				$r = $r . '    <p>Morbi tincidunt, dui sit ameteo nisi vel felis. Mauris consectetur tortor et purus.</p>' . "\n";
				$r = $r . '  </div>' . "\n";
				$r = $r . '  <div id="tabs-3">' . "\n";
				$r = $r . '    <h2>Content heading 3</h2>' . "\n";
				$r = $r . '    <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Ali. Praesent eu risus hendrerit ligula t nec, luctus a, lacus.</p>' . "\n";
				$r = $r . '    <p>Duis cursus. Maecenas ligula eros, t.</p>' . "\n";
				$r = $r . '  </div>' . "\n";
				$r = $r . '</div>' . "\n";
				
				break;
*/
			default :
				$cAUDIT->AddAudit ( AUDIT_EXTEND, __DIR__, __FILE__, __LINE__, __CLASS__, __METHOD__, __FUNCTION__, $language [$IDIOMA] [79] . $FORM_OPERATION );
		}
		
		return $r;
		
		/*
		 * // Cargamos las marcas $r = $r . $BD->Load ( TABLA_MARCAS ); // Cargamos los combustibles $r = $r . $BD->Load ( TABLA_COMBUSTIBLES ); // Cargamos las operaciones $r = $r . $BD->Load ( TABLA_OPERACIONES ); }
		 */
	}
	function __construct() {
		global $cAUDIT;
		
		$cAUDIT->AddAudit ( AUDIT_EXTEND, __DIR__, __FILE__, __LINE__, __CLASS__, __METHOD__, __FUNCTION__, "::constructor (" . __CLASS__ . ")" );
		
		return true;
	}
	private static $_instance;
	public static function getInstance() {
		if (! (self::$_instance instanceof self)) {
			self::$_instance = new self ();
		}
		return self::$_instance;
	}
}
;

// Instancia de la clase
try {
	$cHTML_web = c_HTML_web::getInstance ();
} catch ( Exception $e ) {
	global $cAUDIT;
	global $IDIOMA, $language;
	
	$cAUDIT->AddAudit ( AUDIT_EXTEND, __DIR__, __FILE__, __LINE__, __CLASS__, __METHOD__, __FUNCTION__, $language [$IDIOMA] [2] . $e->getMessage () );
}

?>
